<?php
/*

CREATE TABLE tree (
	pid uuid null,
	trail ltree null,
	level integer not null,
	PRIMARY KEY(id)
) inherits (object);

 */
abstract class Agitum_Orm_Tree extends Agitum_Orm_Object
{
    protected function init()
    {
        parent::init();
        
        $this->name = 'tree';
        $this->title = 'Дерево';
        
        $this->schema['pid'] = Agitum_Orm_Attribute::factory(
            Agitum_Orm_Attirbute_Type::UUID, 
            array(
                'name' => 'pid',
                'title' => 'Родитель',
                'sortOrder' => '60'
            )
        );
        
        $this->schema['trail'] = Agitum_Orm_Attribute::factory(
            Agitum_Orm_Attirbute_Type::LTree, 
            array(
                'name' => 'trail',
                'title' => 'Родитель',
                'sortOrder' => '70'
            )
        );
        
        $this->schema['level'] = Agitum_Orm_Attribute::factory(
            Agitum_Orm_Attirbute_Type::Integer, 
            array(
                'name' => 'level',
                'title' => 'Родитель',
                'sortOrder' => '80'
            )
        );
    }
}